/* eslint-disable */
import React from 'react';
import { Router, Route, Switch } from 'dva/router';
import dynamic from 'dva/dynamic';
import { LocaleProvider } from 'antd';
import zh_CN from 'antd/lib/locale-provider/zh_CN';
import 'moment/locale/zh-cn';

const routes = [
    {
        path: '/',
        models: () => [import('./models/app')],
        component: () => import('./routes/login/Login.js'),
    },
    {
        path: '/App*',
        models: () => [import('./models/app')],
        component: () => import('./components/layout/App'),
    },
    /*
    * @description:
    * @author: ZSH
    * @Date: 2020-2-16 08:44:00
    * @Email: 291303074@qq.com
    * @LastEditTime: 
    */
    // 车辆违规管理
    {
        path: '/carViolationManage',
        models: () => [import('./models/carViolationManage')],
        component: () => import('./routes/CarViolationManage/carViolationManage'),
    },
    // 人员信息管理
    {
        path: '/peoInfoManage',
        models: () => [import('./models/peoInfoManage')],
        component: () => import('./routes/Backstage/PeoInfoManage/peoInfoManage'),
    },
    // 车辆信息管理
    {
        path: '/carInfoManage',
        models: () => [import('./models/carInfoManage')],
        component: () => import('./routes/Backstage/CarInfoManage/carInfoManage'),
    },
    // 收运对象管理
    {
        path: '/collectionObjManage',
        models: () => [import('./models/collectionObjManage')],
        component: () => import('./routes/Backstage/CollectionObjManage/collectionObjManage'),
    },
    // 收运计量实时监控
    {
        path: '/collectionAmountMonitor',
        models: () => [import('./models/collectionAmountMonitor')],
        component: () => import('./routes/CollectionAmount/CollectionAmountMonitor/collectionAmountMonitor')
    },
    // 收运计量统计
    {
        path: '/collectionAmountStatistics',
        models: () => [import('./models/collectionAmountStatistics')],
        component: () => import('./routes/CollectionAmount/CollectionAmountStatistics/collectionAmountStatistics')
    },
    // 收运需求管理
    {
        path: '/collectionDemand',
        models: () => [import('./models/collectionDemand')],
        component: () => import('./routes/CarDispatch/CollectionDemand/collectionDemand')
    },
]; 



function RouterConfig({ history, app }) {
    return (
        <LocaleProvider locale={zh_CN}>
            <Router history={history}> 
                <Switch>  
                    {
                        routes.map(({ path, ...dynamics }, key) => (
                            <Route
                                key={path}
                                exact
                                path={path}
                                component={dynamic({
                                    app,
                                    ...dynamics,
                                })}
                            />
                        ))
                    }
                </Switch>
            </Router>
        </LocaleProvider>
    );
}

export default RouterConfig;
module.exports = RouterConfig;